/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.a;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.text.TextUtils;
import com.qihoo.a.a.a.a;
import com.qihoo.gamecenter.sdk.common.i.j;
import com.qihoo.gamecenter.sdk.common.i.k;
import com.qihoo.gamecenter.sdk.login.plugin.d.a;
import com.qihoo.gamecenter.sdk.login.plugin.g.i.a;
import com.qihoo.gamecenter.sdk.login.plugin.g.p;
import com.qihoo.gamecenter.sdk.login.plugin.g.p.a;
import com.qihoo.gamecenter.sdk.login.plugin.h.o;
import com.qihoo.gamecenter.sdk.login.plugin.login.e.a;
import com.qihoo.gamecenter.sdk.login.plugin.login.view.b;
import com.qihoo.stat.QHStatDo;
import java.util.HashMap;
import java.util.LinkedList;
import org.json.JSONObject;

public class f {
    private Context b;
    private Intent c;
    private com.qihoo.gamecenter.sdk.login.plugin.login.e d = null;
    private a e = null;
    private c f = null;
    private int g = 0;
    a a = null;
    private boolean h = false;
    private boolean i = false;
    private String j = null;
    private String k = null;
    private String l = null;
    private static e m = null;
    private long n;
    private boolean o = false;
    private boolean p = true;
    private b q = null;
    private o r = new o();
    private boolean s = true;

    public f(Context paramContext, Intent paramIntent) {
        this.b = paramContext;
        this.c = paramIntent;
        this.e = new a(paramContext, paramIntent);
    }

    public void a(int paramInt) {
        this.g = paramInt;
    }

    public int a() {
        return this.g;
    }

    public void a(a parama) {
        this.a = parama;
    }

    public void a(boolean paramBoolean) {
        this.h = paramBoolean;
    }

    public void b(boolean paramBoolean) {
        this.i = paramBoolean;
    }

    public boolean b() {
        return this.i;
    }

    public void a(String paramString) {
        this.j = paramString;
    }

    public String c() {
        return this.j;
    }

    public void b(String paramString) {
        this.k = paramString;
    }

    public void c(String paramString) {
        this.l = paramString;
    }

    public com.qihoo.gamecenter.sdk.login.plugin.login.e a(LinkedList paramLinkedList) {
        this.d = new com.qihoo.gamecenter.sdk.login.plugin.login.e(this.b, paramLinkedList);
        return this.d;
    }

    public com.qihoo.gamecenter.sdk.login.plugin.login.e d() {
        return this.d;
    }

    public static synchronized void a(e parame) {
        if ((m != parame) && (m != null))
            m.a();
        m = parame;
    }

    public e e() {
        return m;
    }

    public void c(boolean paramBoolean) {
        this.o = paramBoolean;
    }

    public boolean f() {
        return this.o;
    }

    public void d(boolean paramBoolean) {
        this.p = paramBoolean;
    }

    public boolean g() {
        return this.p;
    }

    public void a(b paramb) {
        this.q = paramb;
    }

    public boolean h() {
        return this.e.c();
    }

    public void a(e parame, com.qihoo.gamecenter.sdk.login.plugin.login.c paramc, boolean paramBoolean)
  {
    QHStatDo.event("360sdk_login_start", null);
    com.qihoo.gamecenter.sdk.login.plugin.h.d.c();
    com.qihoo.gamecenter.sdk.login.plugin.h.f.i(this.b);
    this.n = System.currentTimeMillis();
    a(parame);
    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "login method = ", Integer.valueOf(paramc.j()) });
    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "login account = ", paramc.b() });
    if (paramc.j() == 4)
      com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "login qt = ", paramc.i() });
    if ((!(paramBoolean)) && (c.a < 70))
    {
      com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "detect appstore not support encrypt! appver = " + c.a });
      if (paramc.j() != 1)
      {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "force use sdk!" });
        paramBoolean = true;
      }
    }
    boolean bool = paramBoolean;
    1 local1 = new e(paramc, parame)
    {
      public void a(JSONObject paramJSONObject)
      {
        f.a(f.this, this.a.b(), paramJSONObject, this.b);
      }
    };
    if ((com.qihoo.gamecenter.sdk.login.plugin.h.c.p) && (!(this.i)))
      new p().a(this.b, this.j, new p.a(paramc, parame, local1, bool)
      {
        public void a(boolean paramBoolean, JSONObject paramJSONObject)
        {
          if (paramBoolean);
          try
          {
            f.a(f.this, this.a.b(), paramJSONObject, this.b);
            return;
          }
          catch (Exception localException)
          {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "local token login fine error!", localException);
            f.a(f.this).a(this.c, this.a, this.d);
          }
        }
      });
    else
      this.e.a(local1, paramc, bool);
  }

    public synchronized void i() {
        this.r.b();
    }

    public synchronized void j() {
        this.r.c();
    }

    public synchronized boolean k() {
        return this.r.a();
    }

    public synchronized boolean l() {
        return this.s;
    }

    private synchronized void e(boolean paramBoolean) {
        this.s = paramBoolean;
    }

    public void a(String paramString1, String paramString2) {
        a(paramString1, com.qihoo.gamecenter.sdk.login.plugin.d.a(d.a.aJ), paramString2);
    }

    public void a(d paramd) {
        if (null == this.f)
            this.f = new c(this.b);
        this.f.a(new c.e(paramd) {
            public void a(ComponentName paramComponentName) {
                if (this.a == null)
                    return;
                this.a.a();
            }

            public void a(ComponentName paramComponentName, IBinder paramIBinder) {
                if ((null == paramComponentName) || (null == paramIBinder)) {
                    if (this.a != null)
                        this.a.a(false);
                    return;
                }
                f.a(f.this).a(a.a.a(paramIBinder));
                if (this.a == null)
                    return;
                this.a.a(f.a(f.this).a());
            }
        });
    }

    public void m() {
        if ((!(this.e.a())) || (this.f == null))
            return;
        this.f.a();
    }

    public LinkedList a(String[] paramArrayOfString)
  {
    LinkedList localLinkedList = new LinkedList();
    if (null == paramArrayOfString)
      return localLinkedList;
    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "remote users: " });
    for (Object localObject2 : paramArrayOfString)
      com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { localObject2 });
    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "remote users end" });
    ??? = null;
    if ((paramArrayOfString != null) && (paramArrayOfString.length > 0))
      for (??? = paramArrayOfString.length - 1; ??? >= 0; --???)
      {
        if (TextUtils.isEmpty(paramArrayOfString[???]))
          continue;
        if (h.b(this.b, paramArrayOfString[???]))
          continue;
        if (com.qihoo.gamecenter.sdk.login.plugin.h.f.b(this.b, paramArrayOfString[???]))
          ??? = paramArrayOfString[???];
        else
          localLinkedList.add(paramArrayOfString[???]);
      }
    if (!(TextUtils.isEmpty((CharSequence)???)))
    {
      localLinkedList.add(???);
      com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "add phone account " + ((String)???) });
    }
    return ((LinkedList)localLinkedList);
  }

    public void a(JSONObject paramJSONObject, String paramString1, String paramString2, boolean paramBoolean) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "onLoginSuccess Entry!" });
        if (com.qihoo.gamecenter.sdk.login.plugin.h.c.p) {
            b(paramJSONObject, paramString1, paramString2, paramBoolean);
            return;
        }
        a(paramJSONObject, paramString1);
        a(paramString1, paramString2, this.i, paramBoolean);
        d(paramString1);
        e(paramString1);
        d(paramJSONObject, paramString1);
        a(paramJSONObject);
        c(paramJSONObject);
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                new Object[] { "login cost = " + (System.currentTimeMillis() - this.n) });
    }

    private void a(JSONObject paramJSONObject, String paramString) {
        if (null == paramJSONObject)
            return;
        if (com.qihoo.gamecenter.sdk.login.plugin.h.c.p) {
            b(paramJSONObject, paramString);
        }
        else {
            if (!(com.qihoo.gamecenter.sdk.login.plugin.h.c.q))
                return;
            c(paramJSONObject, paramString);
        }
    }

    private void b(JSONObject paramJSONObject, String paramString) {
        try {
            JSONObject localJSONObject1 = paramJSONObject.getJSONObject("data");
            String str1 = localJSONObject1.optString("access_token", "");
            JSONObject localJSONObject2 = localJSONObject1.getJSONObject("user_login_res");
            JSONObject localJSONObject3 = localJSONObject2.getJSONObject("data");
            String str2 = localJSONObject3.optString("phone", "");
            String str3 = localJSONObject3.optString("nick", "");
            JSONObject localJSONObject4 = localJSONObject3.getJSONObject("accessinfo").getJSONObject("user_me");
            String str4 = localJSONObject4.optString("id", "");
            String str5 = localJSONObject4.optString("name", "");
            com.qihoo.gamecenter.sdk.login.plugin.h.d.e(paramString);
            com.qihoo.gamecenter.sdk.login.plugin.h.d.a(com.qihoo.gamecenter.sdk.common.a.a.a(paramString));
            com.qihoo.gamecenter.sdk.login.plugin.h.d.c(str1);
            com.qihoo.gamecenter.sdk.login.plugin.h.d.b(str2);
            com.qihoo.gamecenter.sdk.login.plugin.h.d.d(str3);
            com.qihoo.gamecenter.sdk.login.plugin.h.d.a(this.b, str4);
            com.qihoo.gamecenter.sdk.login.plugin.h.d.f(str5);
        } catch (Exception localException) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "saveCookieUtilsDataInSocial Error!",
                    localException);
        }
    }

    private void c(JSONObject paramJSONObject, String paramString) {
        com.qihoo.gamecenter.sdk.login.plugin.h.d.e(paramString);
        com.qihoo.gamecenter.sdk.login.plugin.h.d.a(com.qihoo.gamecenter.sdk.common.a.a.a(paramString));
    }

    private void b(JSONObject paramJSONObject, String paramString1, String paramString2, boolean paramBoolean) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "onLoginSucess4Social Entry" });
        a(paramJSONObject, paramString1);
        a(paramString1, paramString2, this.i, paramBoolean);
        d(paramString1);
        e(paramString1);
        d(paramJSONObject, paramString1);
        b(paramJSONObject);
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                new Object[] { "login cost = " + (System.currentTimeMillis() - this.n) });
    }

    public void n() {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "resetLoginState Entry!" });
        a(null);
        this.g = 0;
        this.a = null;
        this.h = false;
        this.i = false;
        this.j = null;
        this.k = null;
        e(true);
        this.r.e();
    }

    public com.qihoo.gamecenter.sdk.login.plugin.login.c a(boolean paramBoolean1, boolean paramBoolean2,
            String paramString1, String paramString2) {
        com.qihoo.gamecenter.sdk.login.plugin.login.c localc = new com.qihoo.gamecenter.sdk.login.plugin.login.c();
        localc.a(paramBoolean1);
        if (!(TextUtils.isEmpty(paramString1))) {
            localc.e(paramString1);
            localc.d(paramString2);
        }
        localc.c(this.k);
        localc.b(paramBoolean2);
        localc.b(this.j);
        localc.a(this.g);
        if (this.a != null) {
            localc.f(this.a.a());
            localc.g(this.a.b());
        }
        if (!(TextUtils.isEmpty(this.l)))
            localc.h(this.l);
        return localc;
    }

    public boolean o() {
        if (null == this.d)
            return false;
        return ((this.d.e() != null) && (this.d.e().size() > 0) && (TextUtils
                .isEmpty(com.qihoo.gamecenter.sdk.login.plugin.h.g.b(this.b))));
    }

    public boolean p() {
        if (this.e.a()) {
            e.a locala = this.d.a();
            if ((locala != null) && (this.d.b(locala.c())) && (locala.a())) {
                com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                        new Object[] { "should auto login detect can login by service!" });
                a(1);
                a(locala.c());
                return true;
            }
        }
        return false;
    }

    public boolean q() {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                new Object[] { "canAutoLoginBySdkSelf Entry!" });
        e.a locala = this.d.a();
        int i1 = 0;
        if (locala != null) {
            String str1 = locala.c();
            if (!(TextUtils.isEmpty(str1))) {
                String str2 = locala.d();
                if ((!(TextUtils.isEmpty(str2))) && (str2.length() == 32)) {
                    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                            new Object[] { "detect can auto login by username and pwd!" });
                    i1 = 1;
                    if (0 == a())
                        a(2);
                }
                else {
                    String str3 = com.qihoo.gamecenter.sdk.login.plugin.c.a.a(this.b).c(str1);
                    if (!(TextUtils.isEmpty(str3))) {
                        i1 = 1;
                        c(str3);
                        if (0 == a())
                            a(4);
                        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                                new Object[] { "detect can auto login by cached qt!" });
                    }
                }
                if (i1 != 0) {
                    a(str1);
                    b(false);
                }
            }
        }
        return i1;
    }

    public com.qihoo.a.a.a r() {
        return this.e.b();
    }

    public void a(n paramn) {
        this.e.a(paramn);
    }

    public void a(i parami, String paramString) {
        this.e.a(parami, paramString);
    }

    private void a(String paramString1, String paramString2, boolean paramBoolean1, boolean paramBoolean2) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "saveUserNameAndPwd Entry!" });
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "userName = " + paramString1 });
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "pwd = " + paramString2 });
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "isManualLogin = "
                + paramBoolean1 });
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "isPwdChanged = "
                + paramBoolean2 });
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "logintype = " + this.g });
        e.a locala = this.d.c(paramString1);
        if ((2 == this.g) || ((locala != null) && (locala.b()))) {
            String str = null;
            str = "auto";
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "convertedPwd = " + str });
            this.d.a(paramString1, str);
        }
        else {
            this.d.a(paramString1, "auto");
        }
    }

    private void d(String paramString) {
        com.qihoo.gamecenter.sdk.login.plugin.h.g.c(this.b, paramString);
        if (b.b(this.b))
            b.a(this.b, paramString);
        com.qihoo.gamecenter.sdk.login.plugin.h.g.a(this.b, "gamecenter_sdk_plugin_key_excute_bind", true);
    }

    private void e(String paramString) {
        if (!(this.h))
            return;
        if (this.a != null)
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "Token param have data" });
        String str = com.qihoo.gamecenter.sdk.login.plugin.h.d.b();
        if (TextUtils.isEmpty(str))
            return;
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "save qt: " + str });
        com.qihoo.gamecenter.sdk.login.plugin.h.f.a(this.b, paramString);
    }

    private void a(String paramString1, String paramString2, String paramString3) {
        if (paramString1 == null)
            return;
        com.qihoo.gamecenter.sdk.login.plugin.login.view.g.a(this.b, paramString3).a(paramString1, paramString2);
    }

    private void d(JSONObject paramJSONObject, String paramString) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                new Object[] { "saveTokenAccountAndQT Entry! account: " + paramString + " res: " + paramJSONObject });
        com.qihoo.gamecenter.sdk.login.plugin.c.a locala = com.qihoo.gamecenter.sdk.login.plugin.c.a.a(this.b);
        if (null == locala)
            return;
        String str1 = null;
        String str2 = null;
        String str3 = com.qihoo.gamecenter.sdk.login.plugin.h.d.b();
        try {
            JSONObject localJSONObject = paramJSONObject.getJSONObject("data");
            str1 = localJSONObject.getString("access_token");
            str2 = paramJSONObject.toString();
        } catch (Exception localException) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "saveTokenAccountAndQT Exception!",
                    localException);
        }
        if ((TextUtils.isEmpty(str1)) || (TextUtils.isEmpty(str2)) || (TextUtils.isEmpty(paramString))
                || (TextUtils.isEmpty(str3)))
            return;
        locala.a(paramString, str1, str3, str2);
        com.qihoo.gamecenter.sdk.login.plugin.h.d.c(str1);
    }

    private void a(JSONObject paramJSONObject) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "trimLoginResult" });
        if (paramJSONObject == null)
            return;
        try {
            if (paramJSONObject.has("user"))
                paramJSONObject.remove("user");
        } catch (Exception localException) {}
    }

    private void b(JSONObject paramJSONObject) {
        if (null == paramJSONObject)
            return;
        try {
            JSONObject localJSONObject1 = paramJSONObject.getJSONObject("data");
            JSONObject localJSONObject2 = localJSONObject1.getJSONObject("user_login_res");
            JSONObject localJSONObject3 = localJSONObject2.getJSONObject("data");
            com.qihoo.gamecenter.sdk.login.plugin.h.f.a(localJSONObject3, "qid");
            JSONObject localJSONObject4 = localJSONObject3.getJSONObject("accessinfo");
            com.qihoo.gamecenter.sdk.login.plugin.h.f.a(localJSONObject4, "token_info");
            com.qihoo.gamecenter.sdk.login.plugin.h.f.a(localJSONObject4, "qid");
            com.qihoo.gamecenter.sdk.login.plugin.h.f.a(localJSONObject4, "accessToken");
        } catch (Exception localException) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "trimLoginResult4Social error!",
                    localException);
        }
    }

    private void c(JSONObject paramJSONObject) {
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "addQT Entry!" });
        if (paramJSONObject == null)
            return;
        try {
            JSONObject localJSONObject = paramJSONObject.getJSONObject("data");
            localJSONObject.put("qt", com.qihoo.gamecenter.sdk.login.plugin.h.d.b());
            localJSONObject.put("qid", com.qihoo.gamecenter.sdk.login.plugin.h.d.d());
            localJSONObject.put("account", c());
        } catch (Exception localException) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "add qt id error!", localException);
        }
    }

    private void b(String paramString, JSONObject paramJSONObject, e parame)
  {
    com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "onLoginReturn res = ", paramJSONObject });
    Handler localHandler = new Handler();
    if (this.r.a())
    {
      new Thread(new Runnable(localHandler, paramString, paramJSONObject, parame)
      {
        public void run()
        {
          f.b(f.this).d();
          this.a.post(new Runnable()
          {
            public void run()
            {
              f.a(f.this, false);
              f.this.a(f.4.this.b, f.4.this.c, f.4.this.d);
            }
          });
        }
      }).start();
      return;
    }
    e(false);
    a(paramString, paramJSONObject, parame);
  }

    public void a(String paramString, JSONObject paramJSONObject, e parame) {
        if (!(b(parame)))
            return;
        com.qihoo.gamecenter.sdk.login.plugin.h.g.c(this.b, paramString);
        a(paramJSONObject, paramString);
        boolean bool = this.c.getBooleanExtra("hide_guide", false);
        int i1 = f(bool);
        int i2 = paramJSONObject.optInt("errno", -1);
        if ((false == bool) && (0 == i2) && (i1 != 0)) {
            new com.qihoo.gamecenter.sdk.login.plugin.g.i(this.b, f(), g(), i1).a(paramString, new i.a(parame,
                    paramJSONObject, paramString) {
                boolean a = false;

                public void a(JSONObject paramJSONObject) {
                    if (!(f.a(f.this, this.b)))
                        return;
                    if (com.qihoo.gamecenter.sdk.login.plugin.h.c.p)
                        try {
                            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                                    new Object[] { "onModifyFine Entry! res = " + paramJSONObject });
                            JSONObject localJSONObject1 = this.c.getJSONObject("data");
                            JSONObject localJSONObject2 = localJSONObject1.getJSONObject("user_login_res");
                            if (paramJSONObject != null) {
                                String str;
                                Object localObject;
                                if (1 == paramJSONObject.optInt("modify_nick", 0)) {
                                    str = paramJSONObject.optString("nick", null);
                                    if (!(TextUtils.isEmpty(str))) {
                                        localObject = localJSONObject2.getJSONObject("data");
                                        ((JSONObject) localObject).put("no_self_display_nick", str);
                                        ((JSONObject) localObject).put("nick", str);
                                    }
                                }
                                else if (1 == paramJSONObject.optInt("bind_phone", 0)) {
                                    str = this.c.optString("phone", null);
                                    if (!(TextUtils.isEmpty(str))) {
                                        localObject = k.a(str);
                                        localObject = ((String) localObject).substring(16);
                                        com.qihoo.gamecenter.sdk.login.plugin.h.d.b((String) localObject);
                                    }
                                }
                                else if (1 == paramJSONObject.optInt("modify_head", 0)) {
                                    str = this.c.optString("avatar", null);
                                    if (!(TextUtils.isEmpty(str))) {
                                        localObject = localJSONObject2.getJSONObject("data");
                                        JSONObject localJSONObject3 = ((JSONObject) localObject)
                                                .getJSONObject("accessinfo");
                                        JSONObject localJSONObject4 = localJSONObject3.getJSONObject("user_me");
                                        localJSONObject4.put("avatar", str);
                                    }
                                }
                            }
                        } catch (Exception localException) {
                            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "modify fine error!",
                                    localException);
                        }
                    if (false == this.a) {
                        f.a(f.this, this.d, this.c);
                        this.a = true;
                    }
                    this.b.a(this.c);
                }

                public boolean a() {
                    if (!(f.a(f.this, this.b)))
                        return false;
                    if (false == this.a) {
                        f.a(f.this, this.d, this.c);
                        this.a = true;
                    }
                    if (f.c(f.this) != null)
                        f.c(f.this).a();
                    return true;
                }
            });
        }
        else {
            b(paramString, paramJSONObject);
            parame.a(paramJSONObject);
        }
        a(paramString, paramJSONObject);
        long l1 = System.currentTimeMillis() - this.n;
        com.qihoo.gamecenter.sdk.login.plugin.h.h.a(this.b, l1);
    }

    private void a(String paramString, JSONObject paramJSONObject) {
        int i1 = -1;
        String str1 = "";
        try {
            i1 = paramJSONObject.optInt("errno", -1);
            str1 = paramJSONObject.optString("errmsg", "");
            str1 = h.a(i1, str1);
        } catch (Exception localException) {
            j.d("Plugin.LoginLogic", "statOnLoginReturn Error!", new Object[] { localException });
        }
        HashMap localHashMap = new HashMap();
        localHashMap.put("login_is_auto", (this.i) ? "false" : "true");
        int i2 = com.qihoo.gamecenter.sdk.common.a.a.a(paramString);
        String str2;
        if (1 == i2)
            str2 = "mail";
        else if (2 == i2)
            str2 = "phone";
        else
            str2 = "user_name";
        localHashMap.put("login_account_type", str2);
        if (i1 != 0) {
            localHashMap.put("login_error_msg", str1);
            localHashMap.put("login_error_no", "" + i1);
        }
        QHStatDo.event((0 == i1) ? "360sdk_login_success" : "360sdk_login_failed", localHashMap);
    }

    private void b(String paramString, JSONObject paramJSONObject) {
        if (null == paramJSONObject)
            return;
        try {
            int i1 = paramJSONObject.optInt("errno", -1);
            if (0 != i1) {
                com.qihoo.gamecenter.sdk.login.plugin.h.e
                        .a("Plugin.LoginLogic", new Object[] { "login error return!" });
                return;
            }
        } catch (Exception localException) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.b("Plugin.LoginLogic", "check show wellcome error!",
                    localException);
            return;
        }
        if (((!(this.i)) && (!(this.c.getBooleanExtra("autologin_noui", false))))
                || (false != this.c.getBooleanExtra("hide_wellcom", false)))
            return;
        com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic", new Object[] { "show Wellcome UI!" });
        a(paramString, null);
    }

    private int f(boolean paramBoolean) {
        if (paramBoolean)
            return 0;
        if (!(this.c.hasExtra("guide_flg")))
            return 7;
        int i1 = this.c.getIntExtra("guide_flg", 0);
        boolean bool1;
        boolean bool2;
        if (com.qihoo.gamecenter.sdk.login.plugin.h.f.a(i1, 2)) {
            bool1 = com.qihoo.gamecenter.sdk.login.plugin.accountBind.a.a.a(this.b);
            bool2 = com.qihoo.gamecenter.sdk.login.plugin.accountBind.a.a.a(this.b,
                    com.qihoo.gamecenter.sdk.login.plugin.h.d.d());
            if ((bool1) || (bool2))
                i1 = com.qihoo.gamecenter.sdk.login.plugin.h.f.b(i1, 2);
        }
        if (com.qihoo.gamecenter.sdk.login.plugin.h.f.a(i1, 4)) {
            bool1 = com.qihoo.gamecenter.sdk.login.plugin.profile.a.b(this.b,
                    com.qihoo.gamecenter.sdk.login.plugin.h.d.d());
            bool2 = com.qihoo.gamecenter.sdk.login.plugin.profile.a.a(this.b,
                    com.qihoo.gamecenter.sdk.login.plugin.h.d.d());
            if ((bool1) || (bool2))
                i1 = com.qihoo.gamecenter.sdk.login.plugin.h.f.b(i1, 4);
        }
        return i1;
    }

    private boolean b(e parame) {
        if ((null == m) || (m.b())) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                    new Object[] { "current login listener is invalid" });
            return false;
        }
        if (m != parame) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("Plugin.LoginLogic",
                    new Object[] { "current login is a new one" });
            return false;
        }
        return true;
    }

    public static class a {
        private String a = null;
        private String b = null;
        private String c = null;

        public a(String paramString1, String paramString2, String paramString3) {
            this.a = paramString1;
            this.b = paramString2;
            this.c = paramString3;
        }

        public String a() {
            return this.b;
        }

        public String b() {
            return this.c;
        }
    }

    public static abstract interface b {
        public abstract void a();
    }
}